using Common.DEncrypt;
using DukeyFileEncoding.Properties;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace DukeyFileEncoding {
    public class Register : Form {
        private Button button1;
        private Button button2;
        private IContainer components;
        private string cpuid = "";
        private Label label1;
        private Label label2;
        private Label label3;
        private Label label4;
        private LinkLabel linkLabel1;
        private TextBox txtRegKey;
        private TextBox txtSignKey;

        public Register(string signkey) {
            this.InitializeComponent();
            this.cpuid = signkey;
            this.txtSignKey.Text = signkey;
        }

        private void button1_Click(object sender, EventArgs e) {
            if (this.txtRegKey.Text.Trim() == Common.DEncrypt.DEncrypt.Encrypt(this.cpuid)) {
                base.DialogResult = DialogResult.OK;
                Settings.Default.regkey = this.txtRegKey.Text.Trim();
                Settings.Default.Save();
                MessageBox.Show("注册成功!");
            }
            else {
                MessageBox.Show("注册码不正确!");
            }
        }

        private void button2_Click(object sender, EventArgs e) {
            Clipboard.SetText(this.txtSignKey.Text.Trim());
        }

        protected override void Dispose(bool disposing) {
            if (disposing && (this.components != null)) {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent() {
            this.label1 = new Label();
            this.txtRegKey = new TextBox();
            this.label2 = new Label();
            this.linkLabel1 = new LinkLabel();
            this.label3 = new Label();
            this.button1 = new Button();
            this.label4 = new Label();
            this.txtSignKey = new TextBox();
            this.button2 = new Button();
            base.SuspendLayout();
            this.label1.AutoSize = true;
            this.label1.Font = new Font("宋体", 10.5f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            this.label1.ForeColor = Color.ForestGreen;
            this.label1.Location = new Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x181, 0x2a);
            this.label1.TabIndex = 0;
            this.label1.Text = "你的使用权限已过期,如要继续使用需要购买授权注册码,现在\r\n\r\n需要注册吗?";
            this.txtRegKey.Location = new Point(15, 0x75);
            this.txtRegKey.Name = "txtRegKey";
            this.txtRegKey.Size = new Size(0x14b, 0x15);
            this.txtRegKey.TabIndex = 1;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(13, 0x65);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x5f, 12);
            this.label2.TabIndex = 2;
            this.label2.Text = "直接输入注册码:";
            this.linkLabel1.AutoSize = true;
            this.linkLabel1.Location = new Point(14, 0x98);
            this.linkLabel1.Name = "linkLabel1";
            this.linkLabel1.Size = new Size(0x95, 12);
            this.linkLabel1.TabIndex = 3;
            this.linkLabel1.TabStop = true;
            this.linkLabel1.Text = "没有注册码?我要立即购买!";
            this.linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
            this.label3.AutoSize = true;
            this.label3.ForeColor = SystemColors.ControlDarkDark;
            this.label3.Location = new Point(0xb6, 0x98);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0xf5, 12);
            this.label3.TabIndex = 4;
            this.label3.Text = "如果支付遇到问题,请联系作者qq:1902976602\r\n";
            this.button1.Location = new Point(0x160, 0x74);
            this.button1.Name = "button1";
            this.button1.Size = new Size(0x4b, 0x17);
            this.button1.TabIndex = 5;
            this.button1.Text = "点此注册";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new EventHandler(this.button1_Click);
            this.label4.AutoSize = true;
            this.label4.Location = new Point(14, 0x60);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x2f, 12);
            this.label4.TabIndex = 2;
            this.label4.Text = "机器码:";
            this.label4.Visible = false;
            this.txtSignKey.Enabled = false;
            this.txtSignKey.Location = new Point(0x43, 0x5b);
            this.txtSignKey.Name = "txtSignKey";
            this.txtSignKey.Size = new Size(0xc9, 0x15);
            this.txtSignKey.TabIndex = 1;
            this.txtSignKey.Visible = false;
            this.button2.Location = new Point(0x110, 90);
            this.button2.Name = "button2";
            this.button2.Size = new Size(0x4b, 0x17);
            this.button2.TabIndex = 5;
            this.button2.Text = "复制";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Visible = false;
            this.button2.Click += new EventHandler(this.button2_Click);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.ClientSize = new Size(0x1c3, 0xbb);
            base.Controls.Add(this.button2);
            base.Controls.Add(this.button1);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.linkLabel1);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.txtSignKey);
            base.Controls.Add(this.txtRegKey);
            base.Controls.Add(this.label1);
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "Register";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "软件注册";
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
            Process.Start("explorer.exe", "http://www.mou18.com/bianma_" + this.cpuid + ".html");
        }
    }
}

